/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// lfbscr16.hpp - Linear screen driver for 16-bpp (65k color) operation.
//
// Author: Jim DeLisle
//
// Copyright (c) 1997-2006 Swell Software 
//              All Rights Reserved.
//
// Unauthorized redistribution of this source code, in whole or part,
// without the express written permission of Swell Software
// is strictly prohibited.
//
// Notes:
//
// This driver supports the Linux Frame Buffer at 16 bits per pixel
// hardware. It assumes that the Linux kernel has properly configured
// all of the video hardware.
//
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef LFBSCR16_HPP_
#define LFBSCR16_HPP_

#include <linux/fb.h>   // for fb* structs

#if (PEG_ORIENTATION == PEG_ORIENTATION_NATIVE)
#include "l16scrn.hpp"
#else
#include "pro16scrn.hpp"
#endif  // PEG_ORIENTATION

#if defined(PEG_MULT_SOFT_SURFACES)
/*--------------------------------------------------------------------------*/
// We need a forward reference to PegWindow for the method prototypes
/*--------------------------------------------------------------------------*/
class PegWindow;
#endif  // PEG_MULT_SOFT_SURFACES

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#if (PEG_ORIENTATION == PEG_ORIENTATION_NATIVE)
class LFBScreen16 : public L16Screen
#else
class LFBScreen16 : public Pro16Screen
#endif  // PEG_ORIENTATION
{
    public:
        LFBScreen16(const PegRect &Size);
        virtual ~LFBScreen16();

    protected:
#if defined(PEG_MOUSE_SUPPORT)
        virtual void HidePointer(void);
        virtual void SetPointerPos(PegPoint);
        virtual void SetPointerType(PEGUINT Type);
#endif
        virtual void BlackScreen(void);
        virtual void WhiteScreen(void);
    private:
        void ConfigureController(void);
        PEGUBYTE *GetVideoAddress(void);
        void MemoryToScreen(void);
        void ReleaseVT(void);

      #if defined(PEG_MULT_SOFT_SURFACES)
        PEGUBYTE *mpCompositeBuffer;
      #endif  // PEG_MULT_SOFT_SURFACES

        struct fb_var_screeninfo mVarScreenInfo;
        struct fb_fix_screeninfo mFixScreenInfo;
        char *mpFb;
        PEGCOLOR *mpSurfaceMem;
        int miFbfd;
        int miOrgTTY;
        int miNextTTY;
        int miOrgVT;
        int miNextVT;
};

#endif  // LFBSCR16_HPP_

